package com.tifa.vote.controller;

import com.tifa.vote.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Classname Mycontroller
 * @Description
 * @Date 2022/6/15 12:07
 * @Created by hengyuan
 */
@Controller
public class Mycontroller {

  @RequestMapping("/index")
  public String index(User user) {
    return "index";
  }

  @RequestMapping("/login")
  public String handle01(@ModelAttribute User user, ModelMap model) {
    if ("admin".equals(user.getName()) && "12345".equals(user.getPassword())) {
      return "choise";
    }
    model.put("msg", "密码错了");
    return "index";
  }
}
